-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct pass #2155
Direct pass #2155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a number of comments. I also want to discuss the overall effect of this PR, but that may have to wait until some other tasks are finished.
@@ -171,8 +171,8 @@ class PlaySelector(situation.IPlaySelector): | |||
""" | |||
|
|||
def __init__(self): | |||
self.curr_situation = situations.Defense | |||
self.curr_play = defense.Defense() | |||
self.curr_situation = situations.Offense |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please uncommit changes to rj_gameplay
if (buffered_responses_[i].associated_request == agent_response.associated_request) { | ||
// add the robot id in the corresponding (increasing) location in the received_robot_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this comment was removed? is it inaccurate somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like all the changes to this file were formatting. unless you needed to change this file for your work, uncommit these changes too.
@@ -203,11 +210,44 @@ communication::PosAgentResponseWrapper Offense::receive_communication_request( | |||
std::get_if<communication::ResetScorerRequest>(&request.request)) { | |||
communication::Acknowledge response = receive_reset_scorer_request(); | |||
comm_response.response = response; | |||
} else if (const communication::PassRequest* pass_request = | |||
std::get_if<communication::PassRequest>(&request.request)) { | |||
rj_geometry::Point robot_position = world_state()->get_robot(true, robot_id_).pose.position(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add some comments clearly explaining the logic implemented here?
} | ||
|
||
return comm_response; | ||
} | ||
|
||
communication::PassResponse Offense::receive_pass_request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass pass_request
by const reference here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hold on, was this copied directly from Position? why don't we just call Position::receive_past_request()
in that case?
@@ -172,6 +175,10 @@ std::optional<RobotIntent> Offense::state_to_task(RobotIntent intent) { | |||
planning::MotionCommand{"path_target", current_location_instant, face_ball}; | |||
intent.motion_command = face_ball_cmd; | |||
return intent; | |||
} else if (current_state_ == AWAITING_SEND_PASS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we really be standing perfectly still and doing nothing while waiting to pass? it's okay for now but let's have a discussion about this and how this entire state machine operates.
@@ -166,6 +166,19 @@ void Position::send_direct_pass_request(std::vector<u_int8_t> target_robots) { | |||
communication_request_ = communication_request; | |||
} | |||
|
|||
void Position::broadcast_direct_pass_request() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a useful addition
@@ -296,9 +296,9 @@ void CoachNode::assign_positions_normal(std::array<uint32_t, kNumShells>& positi | |||
positions[robot_id] = Positions::Offense; | |||
break; | |||
case 2: | |||
positions[robot_id] = Positions::Defense; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncommit these changes if they were just for testing.
@@ -256,7 +258,7 @@ class Position { | |||
const int robot_id_; | |||
|
|||
// the robot our robot is going to be passing to | |||
int target_robot_id; | |||
int target_robot_id = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of this default?
automated style fixes Co-authored-by: sanatd33 <[email protected]>
Description
Modifies the code in offense.cpp to only pass to another offense robot if that target robot is open.
Associated / Resolved Issue
Resolves https://app.clickup.com/t/86ayr29tq
Steps to Test
make run-sim
Robots 1, 2, and 4 are set to Offense by default and forced into the 'Awaiting Passing' state.
Expected result: If either robots 1, 2, or 4 have possession of the ball, they will pass it to another Offense robot, provided that it is open.
Key Files to Review
Review Checklist
(Optional) Sub-issues (for drafts)
Note: if you find yourself breaking this PR into many smaller features, it may make sense to break up the PR into logical units based on these features.